package com.neo.community.commons.util;

//import io.jsonwebtoken.*;

@Deprecated
public class JwtUtils {

    public static final String SUBJECT = "xdclass";
    public static final long EXPIRE = 1000 * 60 * 60 * 24 * 7;
    public static final String APPSECRET = "_/1234";

    /*public static String geneJsonWebToken(User user) {
        if (user == null || user.getId() == null || user.getName() == null || user.getHeadImg() == null) {
            return null;
        }
        String token = Jwts.builder().setSubject(SUBJECT)
                .claim("id", user.getId())
                .claim("name", user.getName())
                .claim("img", user.getHeadImg())
                .setIssuedAt(new Date())
                .setExpiration(new Date(System.currentTimeMillis() + EXPIRE))
                .signWith(SignatureAlgorithm.HS256, APPSECRET).compact();//compact()压缩方法
        return token;

    }

    //校验token
    public static Claims checkJWT(String token) {

        try {
            final Claims claims = Jwts.parser().setSigningKey(APPSECRET).parseClaimsJws(token).getBody();
            return claims;
        } catch (ExpiredJwtException e) {
            e.printStackTrace();
        }

        return null;

    }*/
}
